#pragma once

#include "Lock.h"
#include "Lockable.h"

class AutoLock
{
public:

	AutoLock(Lock& lock) : lock_(lock)
	{
		lock_.Acquire();
	}

	AutoLock(Lockable& lockable) : lock_(lockable.getLock())
	{
		lock_.Acquire();
	}

	~AutoLock(void)
	{
		lock_.Release();
	}

private:
	Lock& lock_;

};
